NW6 | Fathi Kahin | Module-DataBases | Big_Spender | week 2 #160
NW6 | Fathi Kahin | Module-DataBases | Big_Spender | week 2 #160fhkahin wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
|
sayoiscool
left a comment
There was a problem hiding this comment.
Good work overall and good understanding of queries, however there's opportunity to master more postgresql operators.
|
|
||
| ```sql | ||
| INSERT YOUR QUERY HERE | ||
| SELECT amount |
There was a problem hiding this comment.
Almost there! Requirement is to find out the transactions between 30,000 and 31,000, not just the amount. How will your select statement be amended to get the desired result?
| INSERT YOUR QUERY HERE | ||
| SELECT * | ||
| FROM spends | ||
| WHERE description LIKE '%fee%'; |
There was a problem hiding this comment.
Good approach and query is on the right track. However, based on the scenario question, "fee" might be inconsistently capitalised in the data. To avoid missing results, the WHERE clause should account for this. What postgresql operator allows for case insensitive matching? Compare your results
| SELECT sp.date, sp.description, expense.expense_area | ||
| FROM spends sp | ||
| JOIN expense_areas expense ON (sp.expense_area_id = expense.id) | ||
| WHERE expense.expense_area LIKE '%Better Hospital Food%'; |
|
|
||
| ```sql | ||
| INSERT YOUR QUERY HERE | ||
| SELECT to_char(date,'YYYY-MM') AS month, sum(amount) |
There was a problem hiding this comment.
Good job with the date formatting. well done
|
|
||
| ```sql | ||
| INSERT YOUR QUERY HERE | ||
| SELECT sp.amount, sup.supplier |
There was a problem hiding this comment.
The question is for the total amount spent by each supplier. Which operator missing here is needed to get the desired result?
| INSERT YOUR QUERIES HERE | ||
| INSERT INTO spends (expense_type_id, expense_area_id, supplier_id, date, transaction_no, supplier_inv_no, description, amount) | ||
| VALUES (7, 18, 16, '2021-08-19', 38104091, '3780119655', 'Computer Hardware Dell', 32000); | ||
|
|
There was a problem hiding this comment.
Good attempt here. The rows ' Dell', 'Hardware' and 'IT' are missing from other tables, what extra step is needed to have the rows populated where necessary? What effect will this change have on the 'id's inserted in spends table?




Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.